package cn.edu.jxust.common.response.enums;

/**
 * @author QiuKangming
 * @version 1.0
 * @description
 * @since 2020/06/18 09:32
 */

@SuppressWarnings("unused")
public enum ResultStatus {
    /**
     * 前端状态枚举
     */
    SUCCESS(200, "请求成功"),
    CREATED(201, "创建成功"),
    DELETED(204, "删除成功"),
    MODIFIED(205, "修改成功"),
    FAILED(400, "请求失败"),
    PARAM_ERROR(401, "参数错误"),
    NEED_LOGIN(402, "未登录"),
    VISITED_FORBID(403, "权限不足"),
    NOT_FOUND(404, "请求的资源不存在"),
    METHOD_NOT_SUPPERED(405, "请求方式错误"),
    UNPROCESABLE_ENTITY(422, "发生一个验证错误"),
    SYSTEM_ERROR(500, "服务器内部错误"),

    /**
     * 用户状态枚举
     */
    USER_NOT_FOUND(100, "用户不存在"),
    USERNAME_ERROR(101, "用户名错误"),
    USER_DISABLE(102, "用户被禁用"),
    PASSWORD_ERROR(103, "密码错误"),
    ENETITY_FAILED(104, "实体校验失败"),
    TOKEN_ERROR(105, "用户访问令牌有误"),
    NOT_AUTHC(106, "用户未授权");

    private final Integer code;
    private final String msg;

    /**
     * 结果对象
     * @param code 状态码
     * @param msg 消息体
     */
    ResultStatus(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

}
